home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK2.toast / Development Kits / Hardware / Mac OS USB DDK v1.3f3 / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-20  |  2.7 KB  |  103 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1999 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. #define kMouseModuleName    "\pUSBHIDMouseModule"
  22.  
  23. Boolean    immediateError(OSStatus err);
  24. void     InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
  25. void     MouseInitiateTransaction(USBPB *pb);
  26. void     MouseCompletionProc(USBPB *pb);
  27. void     WatchDogCompletionProc(USBPB *pb);
  28. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  29. void     ChainJADBProc(void);
  30. void     UnchainJADBProc(void);
  31.  
  32. static     OSStatus    MouseDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  33. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  34. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  35.  
  36. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  37. void NotifyRegisteredHIDUser(UInt32 refcon, UInt32 reportSize, void * theReport, USBReference theInterfaceRef);
  38.  
  39. void     USBMouseIn(UInt32 refcon, void * theData);
  40.  
  41. #define kMouseRetryCount    3
  42.  
  43. enum driverstages
  44. {  
  45.     kUndefined = 0,
  46.     kSetProtocol,
  47.     kSetIdleRequest,
  48.     kConfigureInterface,
  49.     kSetRemoteWakeup,
  50.     kFindPipe,
  51.     kReadInterruptPipe,
  52.     kReturnFromDriver =     0x1000,
  53.     kRetryTransaction =     0x2000,
  54.     kCompletionInProgess =     0x4000,
  55.     kCompletionPending =     0x8000,
  56.     kStageMask =             0x00ff
  57. };
  58.  
  59. enum watchdogstates
  60. {
  61.     kDelay10Seconds = 1,
  62.     kCheckForAbort
  63. };
  64.  
  65. typedef struct
  66. {
  67.     USBPB                             pb;
  68.     void (*handler)(USBPB             *pb);
  69.     
  70.     Boolean                            intPipeAborted;
  71.     Boolean                            driverRemovalPending;
  72.     
  73.     Boolean                            watchDogActivityFlag;
  74.     Boolean                            watchDogAbortFlag;
  75.     UInt32                            watchDogState;
  76.  
  77.     USBReference                    interfaceRef;
  78.     USBPipeRef                        pipeRef;
  79.     
  80.     USBDeviceDescriptor             deviceDescriptor;
  81.     USBInterfaceDescriptor            interfaceDescriptor;
  82.  
  83.     UInt32                            hidDeviceType;
  84.     UInt8                            hidReport[64];
  85.     UInt32                            maxPacketSize;
  86.     
  87.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  88.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  89.     
  90.     UInt32                            interruptRefcon;
  91.     
  92.     HIDNotificationProcPtr             pNotificationRoutine;
  93.     UInt32                            notificationRefcon;
  94.     
  95.     SInt32                             retryCount;
  96.     SInt32                            transDepth;
  97.     
  98.     CursorDevicePtr                    pCursorDeviceInfo;
  99.     CursorDevice                    cursorDeviceInfo;
  100.     Fixed                            unitsPerInch;
  101. } usbMousePBStruct;
  102.  
  103. #endif //__MouseModuleH__